
import { Modal } from '@arco-design/web-react';

/**
 * 必填项提示
 * @param value 
 * @param title 
 * @param content 
 * @returns 
 */
export default function Messagetip(type: 'info' | 'success' | 'warning' | 'error', content: string, title = '提示') {
	const con = {
		title,
		okText: '确认',
		content: `${content}！`
	};
	switch (type) {
		case 'info':
			return new Promise<boolean>((res) => {
				Modal.info({
					title,
					okText: '确认',
					content: `${content}！`,
					onOk() {
						res(true);
					}
				});
			});
		case 'success':
			return new Promise<boolean>((res) => {
				Modal.success({
					title,
					okText: '确认',
					content: `${content}！`,
					onOk() {
						res(true);
					}
				});
			});
		case 'warning':
			return new Promise<boolean>((res) => {
				Modal.warning({
					title,
					okText: '确认',
					content: `${content}！`,
					onOk() {
						res(true);
					}
				});
			});
		case 'error':
			return new Promise<boolean>((res) => {
				Modal.error({
					title,
					okText: '确认',
					content: `${content}！`,
					onOk() {
						res(true);
					}
				});
			});
	}
}
